package high;

import java.security.PrivateKey;
import java.util.concurrent.TimeUnit;

public class ThreadTest2 {
    private static int num=5;
    public static void main(String[] args) {
        Thread thread1= new Thread(new Runnable() {
            @Override
            public void run() {
                num=num+1;
                System.out.println("num自增了");
            }
        });
        thread1.start();
        Thread thread2= new Thread(new Runnable() {
            @Override
            public void run() {
                int sum=num+1;
                //TimeUnit.SECONDS.sleep(3);
                //thread1.join();
                System.out.println(sum);
            }
        });
        thread2.start();
    }
}
